package demoMod.stsconsole.helpers;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.cards.curses.*;
import demoMod.stsconsole.cards.red.*;
import demoMod.stsconsole.cards.status.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class CardLibrary {
    private static final Map<String, AbstractCard> cards = new HashMap<>();

    public static void initialize() {
        cards.clear();
        cards.put(Strike_R.ID, new Strike_R());
        cards.put(Defend_R.ID, new Defend_R());
        cards.put(Bash.ID, new Bash());
        cards.put(Anger.ID, new Anger());
        cards.put(Armaments.ID, new Armaments());
        cards.put(Barricade.ID, new Barricade());
        cards.put(BattleTrance.ID, new BattleTrance());
        cards.put(Berserk.ID, new Berserk());
        cards.put(BloodForBlood.ID, new BloodForBlood());
        cards.put(Bloodletting.ID, new Bloodletting());
        cards.put(Bludgeon.ID, new Bludgeon());
        cards.put(BodySlam.ID, new BodySlam());
        cards.put(Brutality.ID, new Brutality());
        cards.put(BurningPact.ID, new BurningPact());
        cards.put(Carnage.ID, new Carnage());
        cards.put(Clash.ID, new Clash());
        cards.put(Cleave.ID, new Cleave());
        cards.put(Clothesline.ID, new Clothesline());
        cards.put(Combust.ID, new Combust());
        cards.put(Corruption.ID, new Corruption());
        cards.put(DarkEmbrace.ID, new DarkEmbrace());
        cards.put(DemonForm.ID, new DemonForm());
        cards.put(Disarm.ID, new Disarm());
        cards.put(DoubleTap.ID, new DoubleTap());
        cards.put(Dropkick.ID, new Dropkick());
        cards.put(DualWield.ID, new DualWield());
        cards.put(Entrench.ID, new Entrench());
        cards.put(Evolve.ID, new Evolve());
        cards.put(Exhume.ID, new Exhume());
        cards.put(Feed.ID, new Feed());
        cards.put(FiendFire.ID, new FiendFire());
        cards.put(FireBreathing.ID, new FireBreathing());
        cards.put(Warcry.ID, new Warcry());

        cards.put(Wound.ID, new Wound());
        cards.put(Slime.ID, new Slime());
        cards.put(Dazed.ID, new Dazed());

        cards.put(Parasite.ID, new Parasite());
    }

    public static AbstractCard getCard(String id) {
        return cards.get(id);
    }

    public static List<AbstractCard> getCards(AbstractCard.CardColor color) {
        return cards.values().stream().filter(card -> card.color == color).collect(Collectors.toList());
    }
}
